<template>
    <div class="WorkingSchedule" v-loading="loading">
      <!-- <el-form ref="form" :model="form" label-position="top" class="myform">
        <div>
          <el-form-item label="返回时间">
            <el-date-picker
              value-format="yyyy-MM-dd"
              v-model="date"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </el-date-picker>
          </el-form-item>
        </div>
        <div>
          <el-form-item style="margin-top: 50px">
            <el-button type="primary" @click="onSearch">查询</el-button>
          </el-form-item>
        </div>
      </el-form> -->
      <el-table :data="tableData" style="width: 100%; margin-top: 20px" border>
        <el-table-column label="任务标题" align="center" prop="title">
        </el-table-column>
        <el-table-column label="任务执行时间说明" align="center" prop="datetitle">
        </el-table-column>
        <el-table-column label="任务执行时间编码" align="center" prop="datecode">
        </el-table-column>
        <el-table-column label="接口方法" align="center" prop="api"></el-table-column>
      </el-table>
      <!-- <pagination
        style="clear: both"
        :form="form"
        :total="total"
        @paginationPostOrderTaskList="postAdminCrontabGetCrontabList"
      /> -->
    </div>
  </template>
  
  <script>
  import { postAdminCrontabGetCrontabList, postCodeSetapplyabandoned } from "@/api";
  import pagination from "@/components/pagination.vue";
  export default {
    components: { pagination },
    data() {
      return {
        loading: false,
        cancellationstatus:[
          {
            status:0,
            title:"待审批"
          },
          {
            status:1,
            title:"已通过"
          },
          {
            status:2,
             title:"未通过"
            
          }
        ],
        date: "",
        form: {
        //   status:0,
        //   type_no: "",
        //   strtime: "",
        //   endtime: "",
          // page: 1,
          // size: 10,
        },
        tableData: [],
        total: 1,
      };
    },
    activated() {
      let form = this.form;
      this.postAdminCrontabGetCrontabList(form);
    },
    methods: {
      onSearch() {
        this.downloadloading = true;
        let obj = {};
        let form = this.form;
        let date = this.date;
        form.page = 1;
        if (date) {
          form.strtime = date[0];
          form.endtime = date[1];
        } else {
          form.strtime = "";
          form.endtime = "";
        }
        this.postAdminCrontabGetCrontabList(form);
      },
      // 审批
      onExamine(id, status) {
        this.$confirm(`${status==1?'此操作将永久作废流水号':'此操作将拒绝作废流水号'}, 是否继续?`, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            let obj = {
              id,
              status,
            };
            postCodeSetapplyabandoned(obj).then((res) => {
              let form = this.form;
              this.postAdminCrontabGetCrontabList(form);
              this.$message({
                type: "success",
                message: `${status == 1 ? "已通过" : "已拒绝"}`,
              });
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消",
            });
          });
      },
      // 采购列表
      async postAdminCrontabGetCrontabList(data) {
        this.loading = true;
        this.form = data;
        postAdminCrontabGetCrontabList(data)
          .then((res) => {
            this.loading = false;
            console.log("采购列表", res);
            this.tableData = res.data;
            this.total = Number(res.total);
          })
          .catch((err) => {
            this.loading = false;
          });
      },
    },
  };
  </script>
  
  <style lang="scss" scoped>
  .exportdialogVisible {
    > div:nth-child(1) {
      display: flex;
      > div {
        > span {
          font-weight: 600;
        }
      }
    }
    > div:nth-child(2) {
      margin: 20px 0;
      display: flex;
      > span {
        > span {
          font-weight: 600;
        }
      }
    }
    > div:nth-child(3) {
      display: flex;
      align-items: center;
      /deep/ .el-input {
        width: 200px;
        color: #409eff;
      }
    }
  }
  .cancellationdialogVisible {
    > div:nth-child(1) {
      display: flex;
      > div {
        > span {
          font-weight: 600;
        }
      }
    }
    > div:nth-child(2) {
      margin-top: 20px;
      display: flex;
      align-items: center;
      /deep/ .el-input {
        width: 200px;
      }
      > div:nth-child(3) {
        margin: 0 10px;
        width: 30px;
        height: 1px;
        background: #666;
      }
    }
  }
  .myform {
    display: flex;
    justify-content: space-between;
    > div {
      display: flex;
    }
    &-item {
      margin-right: 10px;
    }
  }
  .export {
    margin-top: 20px;
    display: flex;
    align-items: center;
    float: right;
    > div {
      margin-right: 20px;
      > span {
        color: #409eff;
        font-size: 18px;
        padding: 0 5px;
      }
    }
  }
  .WorkingSchedule {
    background: #ffff;
    padding: 20px;
    border-radius: 2px;
    @include boxShadow;
  }
  </style>
  